package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SetMealMapper {
    /**
     * 添加套餐
     * @param setmeal
     */
    void add(Setmeal setmeal);
    /**
     * 分页查询
     * @param queryPageBean
     * @return
     */
    Page<Setmeal> pageQuery(QueryPageBean queryPageBean);
    /**
     * 根据id查询套餐信息
     * @param id
     * @return
     */
    @Select("select * from t_setmeal where id=#{id}")
    Setmeal findById(Integer id);
    /**
     * 添加套餐和检查组关联关系
     * @param setmealId
     * @param id
     */
    @Insert("insert into t_setmeal_checkgroup(setmeal_id, checkgroup_id) values(#{setmealId},#{id})")
    void insert(Integer setmealId, Integer id);
    /**
     * 修改套餐信息
     * @param setmeal
     */
    void update(Setmeal setmeal);
    @Delete("delete from t_setmeal_checkgroup where setmeal_id=#{id}")
    void deleteById(Integer id);
}
